2 * adiumPurpleCertificateTrustWarning.m
5 * Created by Andreas Monitzer on 2007-11-05.
6 * Copyright 2007 Andreas Monitzer. All rights reserved.
10 #import "adiumPurpleCertificateTrustWarning.h"
11 #import "AIPurpleCertificateTrustWarningAlert.h"
13 #import <Adium/AIObject.h>
14 #import <Adium/AIAccount.h>
15 #import <Adium/AIAccountControllerProtocol.h>
16 #import "ESPurpleJabberAccount.h"
18 void adium_query_cert_chain(PurpleSslConnection *gsc, const char *hostname, CFArrayRef certs, void (*query_cert_cb)(gboolean trusted, void *userdata), void *userdata) {
19 NSObject<AIAccountController> *accountController = [[AIObject sharedAdiumInstance] accountController];
20 // only the jabber service supports this right now
21 NSEnumerator *e = [[accountController accountsCompatibleWithService:[accountController firstServiceWithServiceID:@"Jabber"]] objectEnumerator];
22 ESPurpleJabberAccount *account;
24 while((account = [e nextObject])) {
25 if([account secureConnection] == gsc) {
26 if([account shouldVerifyCertificates])
27 [AIPurpleCertificateTrustWarningAlert displayTrustWarningAlertWithAccount:account
28 hostname:[NSString stringWithUTF8String:hostname]
30 resultCallback:query_cert_cb
33 query_cert_cb(true, userdata);
38 query_cert_cb(true, userdata);